package com.bc.bczbweb.controller;

import com.bc.commoncore.util.StringUtils;
import com.bc.commonentity.common.JsonResult;
import com.bc.bcapi.service.T_User_trading_flowService;
import com.bc.bcmodel.domain.T_User_trading_flowModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.math.BigInteger;

@Controller
@RequestMapping("t_user_trading_flow")
public class T_User_trading_flowController extends BaseController {
    @Autowired
    T_User_trading_flowService t_User_trading_flowService;

    @RequestMapping("list")
    public ModelAndView list() {
        ModelAndView view = super.baseView("列表", "t_user_trading_flow/list");
        return view;
    }

    @RequestMapping("listdo")
    public ModelAndView listdo(T_User_trading_flowModel req) {
        ModelAndView view = super.baseViewAjax("列表", "t_user_trading_flow/listdo");
        view.addObject("data", "null");
        return view;
    }

    @RequestMapping("add")
    public ModelAndView add(BigInteger id) {
        String title = id.intValue() > 0 ? "编辑" : "添加";
        ModelAndView view = super.baseView(title, "t_user_trading_flow/add");
        T_User_trading_flowModel model = new T_User_trading_flowModel();
        model.setId(id);
        T_User_trading_flowModel data = t_User_trading_flowService.findByNamedParam(model);
        view.addObject("data", data);
        view.addObject("title", title);
        return view;
    }

    @RequestMapping("del")
    public JsonResult del(BigInteger id) {
        JsonResult js = new JsonResult();
        t_User_trading_flowService.delete(id);
        return js;
    }
}